home *** CD-ROM | disk | FTP | other *** search
- Path: noc.netcom.net!news
- From: Tarang Deshpande <tarang@willows.com>
- Newsgroups: comp.lang.c
- Subject: Re: Weird Results with this code :(
- Date: Tue, 02 Apr 1996 14:59:02 -0800
- Organization: NETCOM Network Operations
- Message-ID: <3161B136.D7B@willows.com>
- References: <4jqijm$jpk@uwm.edu>
- NNTP-Posting-Host: daffy.willows.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
-
- Peter J Kleczka wrote:
- >
- > The program is supposed to display
- > some digits leave them on the screen for a second or so
- > and then erase them. The "bug" is that the program seems
- > to jump to the timer-loop BEFORE it prints out the digits.
- > Consequently the desired display/delay/erase sequence works
- > in the wrong order: delay/display/erase.
- >
-
-
- It's probably because between the time you initialize now and until
- the loop a second has passed in both printing and waiting for the
- pause. Instead get rid of the line that initializes now and move
- it into the initialization section of the loop.
-
- for ( now = clock(); clock () - now < CLOCKS_PER_SEC; );
-
- Tarang
-